-
Notifications
You must be signed in to change notification settings - Fork 670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor controller to use functional routing #7809
Conversation
Replaces the annotation-based controller with a functional routing approach. Introduces a `RouterFunction` bean to handle HTTP requests, eliminates redundant response creation, and improves efficiency by directly parsing path variables.
Simplified the route definitions by using lambda expressions directly in the RouterFunction. This reduces unnecessary method declarations and enhances readability.
Thanks @nathphon for this suggestion. What is the best approach for a server side app (typically an API) ? This implementation, or this old one ? Please, give me some insights, not in java world 😀 |
@waghanza in very high-throughput systems, the functional style (RouterFunction) may have a slight edge due to its more lightweight design, bypassing some of the overhead involved in handling annotations. and i re write code to be the same style with ActiveJ can you please review and merge this pr |
What do you think @whiplash ? is this considered as a best-practice (and production-read) ? |
cc @mmaryo |
It all makes sense to me. It appears that using Spring these days you have a choice between going MVC of WebFlux. WebFlux seems to have pushed more on the functional pedal (which I tend to prefer). So It makes sense to have both. |
Ok, so using webfux, like functional way seems to be the way to go. But the same impl is no the way to go with the MVC approach. Ok ❤️ |
This change aligns the class name with its intended functionality. The class was previously named incorrectly, which could cause confusion. The new name clarifies its role as a controller within the Spring WebFlux framework.
This change corrects a package naming inconsistency in the BenchmarkController class. The package was previously listed incorrectly as "router" and has been updated to "controller" to reflect its actual content and functionality.
Replaces the annotation-based controller with a functional routing approach. Introduces a
RouterFunction
bean to handle HTTP requests, eliminates redundant response creation, and improves efficiency by directly parsing path variables.